<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>后台登录</title>
<import type='css' file="Css.Admin.reset,Css.Admin.style,Css.Admin.invalid" />
<import file="Script.jquery_1_6" />
</head>
<body id="login">
<div id="login-wrapper" class="png_bg">
  <div id="login-top">
  </div>
  <div id="login-content">
    <form id="loginForm" action="__APP__/Login/login" method="post">
      <div id="notice" class="notification information png_bg" style="display:none"></div>
      <p>
        <label>账号</label>
        <input class="text-input" type="text" id="username" name="username" />
      </p>
      <div class="clear"></div>
      <p>
        <label>密码</label>
        <input class="text-input" type="password" id="password" name="password" />
      </p>
      <div class="clear"></div>
      <p id="remember-password">
        <input type="checkbox" />
        保存登录状态一周</p>
      <div class="clear"></div>
      <p>
        <input class="button" id="loginButton" type="button" value="登录" />
      </p>
    </form>
  </div>
</div>
</body>
</html>
<script>
$(function(){
	$("#username").keydown(function(event){
		if(event.keyCode==13){    
           $("#loginButton").click();
        }
	});
	$("#password").keydown(function(event){
		if(event.keyCode==13){    
           $("#loginButton").click();
        }
	});
	$("#loginButton").click(function(){
		var username = $("#username").val();
		var password = $("#password").val();
		$("#notice").css('display','block');
		var flag = true;
		if(username == ''){
			$("#notice").html('<div>账号不能为空</div>');
			return false;
		}else if(password == ''){
			$("#notice").html('<div>密码不能为空</div>');
			return false;
		}
		$.ajax({
			url:'__APP__/Login/ajaxLoginCheck',
			cache:false,
			type:'POST',
			data:{username:username,password:password},
			async:false,
			dataType:'json',
			success:function(data){
				if(data.status == 0){
					$("#notice").html('<div>账号或者密码错误</div>');
					flag =  false;
				}
			}
		});
		if(flag){
			$("#loginForm").submit();
		}else{
			return false;
		}
	});
});
</script>
